package com.stgy.lease.web.api.controller;

import com.stgy.lease.common.result.Result;
import com.stgy.lease.model.domain.LeaseTerm;
import com.stgy.lease.web.api.service.LeaseTermService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName:LeaseTermController
 * Package:com.stgy.lease.web.api.controller
 * Description:
 *
 * @Author:helei
 * @Create:2024/9/10 - 10:48
 */
@RestController
@RequestMapping("/app/term")
@Tag(name = "用户租期信息")
public class LeaseTermController {

    @Autowired
    private LeaseTermService leaseTermService;

    //http://localhost:8888/app/term/listByRoomId?id=1830435206989889537 GET
    @Operation(summary = "根据房间id获取可选获取租期列表")
    @GetMapping("/listByRoomId")
    public Result<List<LeaseTerm>> listByRoomId(@RequestParam Long id){
        return Result.ok(leaseTermService.listByRoomId(id));
    }
}
